<!--
 * @Description: 属性选择器
 * @Author: rendc
 * @Date: 2022-09-20 10:01:12
 * @LastEditors: rendc
 * @LastEditTime: 2022-09-20 11:11:56
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>子代选择器</title>
  <style>
    * {
      margin: 0;
    }

    /* #app>span {
      border: 1px solid red;
      color: red;
    } */
    div[class*=vh][id=div2] {
      border: 1px solid hotpink;
    }
  </style>
</head>

<body>
  <div style="height: 100vh;background-color: beige;">
    <div id="app">
      <div>1
        <span>1</span>
      </div>
      <div id="div2" class="vh1">2</div>
      <div id="div3p" class="vh ch ">3</div>
      <span id="span2">2</span>
      <span id="s1p">3</span>
    </div>
  </div>
</body>

</html>